// 雷爽爽  start
// 鼠标移入移出方向判断
$(function (){
    var iwrap = $(".wushen_img");
    var float = $(".da_animate ");
    
    iwrap.hover(function(e){//mouse in
    float.css(moveForward(iwrap, e)).stop(true, true).animate({"left":0, "top":0}, 300);
    },function(e){//mouse out
    float.animate(moveForward(iwrap, e), 300);
    });
    });
    
    var moveForward = function(elem, e){
    var w = elem.width(), h = elem.height(), direction=0, cssprop={};
    var x = (e.pageX - elem.offset().left - (w / 2)) * (w > h ? (h / w) : 1);
    var y = (e.pageY - elem.offset().top - (h / 2)) * (h > w ? (w / h) : 1);
    
    direction = Math.round((((Math.atan2(y, x) * (180 / Math.PI)) + 180) / 90) + 3) % 4;
    switch(direction)
    {
    case 0://from top
    cssprop.left = 0;
    cssprop.top = "-100%";
    break;
    case 1://from right
    cssprop.left = "100%";
    cssprop.top = 0;
    break;
    case 2://from bottom
    cssprop.left = 0;
    cssprop.top = "100%";
    break;
    case 3://from left
    cssprop.left = "-100%";
    cssprop.top = 0;
    break;
    }
    return cssprop;
    }
    // 雷爽爽 end